package com.jial08.designpatterns.strategy;

/**
 * <p>类描述：。</p>
 *
 * @author jl
 * @version v1.0.0.1。
 * @since JDK1.8。
 * <p>创建日期：2019/10/15 下午4:18。</p>
 */
public class Demo {
	public static void main(String[] args) {
		int num = 10;
		double price = 15.2;
		double totle = price * num;
		CashContext cashContext = new CashContext(Type.NORMAL, null, null, null);
		double result1 = cashContext.getResult(totle);
		System.out.println("正常收费，单价：" + price + "，数量：" + num + "，总价：" + result1);

		cashContext = new CashContext(Type.REBATE, 0.75, null, null);
		double result2 = cashContext.getResult(totle);
		System.out.println("75折，单价：" + price + "，数量：" + num + "，总价：" + result2);

		cashContext = new CashContext(Type.RETURN, null, 100D, 10D);
		double result3 = cashContext.getResult(totle);
		System.out.println("满100减10元，单价：" + price + "，数量：" + num + "，总价：" + result3);
	}
}
